
#ifndef __VOL_ODBC_RECORD_SET_H__
#define __VOL_ODBC_RECORD_SET_H__

class CVolRecordSet : public CRecordset
{
public:
    CVolRecordSet (CDatabase* pDatabase = NULL);

    inline_ ~CVolRecordSet ()
    {
        Cleanup ();
    }

public:
    INT BDGetRecCount ();
    INT BDGetColCount ();
    const TCHAR* BDGetColText (INT nRowIndex, INT nColIndex);
    INT BDGetColSQLType (INT nIndex);
    BOOL BDSetColText (INT nRowIndex, INT nColIndex, const TCHAR* szText);
    BOOL BDAppendBlank ();
    BOOL BDRemove (INT nRecBeginIndex, INT nRecCount);
    const TCHAR* BDGetColName (INT nColIndex);
    INT GetFieldIndex (const TCHAR* lpszName);
    void MyGetFieldValue (const TCHAR* lpszName, CVolComVariant* pVar);
    void MyGetFieldValue (INT nIndex, CVolComVariant* pVar);
    void FillEmptyData (INT nColIndex, INT nFieldType, CVolComVariant* pVar);
    BOOL BDGetColBin (INT nRowIndex, INT nColIndex, CVolMem& memData);
    BOOL BDSetColBin (INT nRowIndex, INT nColIndex, const void* pData, INT nDataSize);
    BOOL MoveCurrentCursorTo (INT nRowIndex);

    virtual CString GetDefaultConnect() override;
    virtual CString GetDefaultSQL() override;
    virtual void DoFieldExchange(CFieldExchange* pFX) override;
    virtual void CheckRowsetError(RETCODE nRetCode) override;
    BOOL MyOpen(UINT nOpenType = AFX_DB_USE_DEFAULT_TYPE, const TCHAR* lpszSQL = NULL, DWORD dwOptions = none, INT nMaxStrSize = 512, INT nMaxBinSize = 4096);

protected:
    void Cleanup ();

protected:
    CDWordArray m_dwaryColsSQLType;
    CStringArray m_straryColsName, m_straryColsData;
    CPtrArray m_arypColsBin;

    INT m_nMaxStrSize, m_nMaxBinSize;
};

#endif
